home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Visual Database / Visual Foxpro 6.0 (Ent. Edition) / Vf6ent Extractor.EXE / API / SAMPLES / LOGIREPL.C < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-26  |  1.0 KB  |  53 lines

  1. /*
  2. **
  3. *
  4. * LOGIREPL.C - Sample API routine.
  5. *
  6. * Copyright (c) 1989-1993 Microsoft Corporation as an unpublished
  7. * licensed proprietary work.  All rights reserved.
  8. *
  9. * Description:
  10. *        This routine appends a record and replaces the logical field
  11. *        (the fifth field in the structure).
  12. *
  13. **
  14.  */
  15.  
  16.  
  17. #include  <pro_ext.h>
  18. #define WORKAREA        1
  19.  
  20. MHANDLE dbhand = 0;
  21.  
  22. long FAR lreplace()
  23. {
  24.     Locator locate;
  25.     Value val;
  26.      int mwrite, mreplace, mappend;
  27.     int flag = 0;
  28.  
  29.     locate.l_type = 'R';
  30.     locate.l_where = 1;
  31.     locate.l_NTI = 1;
  32.     locate.l_offset = 4;        // this represents the fifth field in the structure
  33.  
  34.     val.ev_type = 'L';
  35.     val.ev_length = 1;
  36.  
  37.         mappend = _DBAppend(WORKAREA,flag);
  38.  
  39.     mreplace = _DBReplace(&locate,&val);
  40.         mwrite = _DBWrite(WORKAREA);    // Flush the changes to disk.
  41.  
  42.     return mappend;
  43. }
  44.  
  45. FoxInfo myFoxInfo[] ={
  46.         {"LREPLACE", (FPFI) lreplace, 0, ""},
  47. };
  48.  
  49.  
  50. FoxTable _FoxTable = {
  51.     (FoxTable FAR *)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo
  52. };
  53.